package api

import (
	"api-server/basic/config"
	"api-server/common/model"
	"api-server/handler/request"
	"github.com/gin-gonic/gin"
	"log"
	"net/http"
)

func MainBusiness(c *gin.Context) {
	var req request.MainBusinessReq
	if err := c.ShouldBind(&req); err != nil {
		c.JSON(http.StatusOK, gin.H{
			"code": 10001,
			"msg":  "验证失败",
			"date": err.Error(),
		})
		return
	}
	var main model.User
	err := config.DB.Where("mobile = ?", req.Mobile).Find(&main).Error
	if err != nil {
		log.Println("用户不存在")
	}
	config.DB.Where("id = ?", main.Id).Find(&main)
	c.JSON(http.StatusOK, gin.H{
		"code": 200,
		"msg":  "访问成功",
		"date": main,
	})
}
